package org.jaaksi.kottlindemo.test

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import libcore.kotpref.AppSp
import org.jaaksi.kottlindemo.databinding.ActivityTestFlowBinding
import org.jaaksi.kottlindemo.leak.BannerAd
import org.jaaksi.kottlindemo.model.Person
import org.jetbrains.anko.toast

class TestLifecycleActivity : AppCompatActivity() {
    private val binding by lazy { ActivityTestFlowBinding.inflate(layoutInflater) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        binding.btn.postDelayed({
            println(">> ${lifecycle.currentState}")
            lifecycleScope.launchWhenResumed {
                println(">> launchWhenResumed")
            }
        }, 5000)
    }
}